home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / vbcc / machines / amigappc / libsrc / stdio / tmpnam.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-06-24  |  504 b   |  26 lines

  1. /*
  2. ** vbcc-Amiga-PowerPC version of tmpnam.c
  3. **
  4. ** v0.1 04.10.97 phx
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <powerup/gcclib/powerup_protos.h>
  9.  
  10. char *tmpnam(char s[L_tmpnam])
  11. {
  12.     static char lastname[L_tmpnam];
  13.     static int lastnum=0;
  14.     BPTR fh=0;
  15.  
  16.     do{
  17.         lastnum++;
  18.         sprintf(lastname,"T:vc_%d",lastnum);
  19.         fh = PPCOpen(lastname,MODE_OLDFILE);
  20.         if(fh) PPCClose(fh);
  21.     }while(fh&&lastnum>0);
  22.     if(lastnum<=0) return(0);
  23.     if(s) strcpy(s,lastname);
  24.     return(lastname);
  25. }
  26.